UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CpDg27qByCxVBeW1nx6T8QnlnxULQHsuXMYvDubkUGM=' 
WHERE 
  key_id = '3bedb170e4b716243be8214f4b959a4c584547bd1db1ed9e6bb6adcbdd5c99bc' 
  AND (
    token = 'CpDg27qByCxVBeW1nx6T8QnlnxULQHsuXMYvDubkUGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028