UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eNiw6CWtOBmpImduoLH06g+O1KiFnCvnYY9uf2DCanM=' 
WHERE 
  key_id = '8a5fcb809c7e39db3107809b86806f13240b1c014656140dbb138184148fb376' 
  AND (
    token = 'eNiw6CWtOBmpImduoLH06g+O1KiFnCvnYY9uf2DCanM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053