UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BBDXlOEe//OFNCGjP65UmFZ/8c93mo7z3zJoZqn+9d0=' 
WHERE 
  key_id = '84a6953f2f00704c0c807be116f15ac05fe3910578f122dc7ed88fed983c2f78' 
  AND (
    token = 'BBDXlOEe//OFNCGjP65UmFZ/8c93mo7z3zJoZqn+9d0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038