UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CYbodil5oxHMWi7/gwc8CvW9jczCqkP0HI3reV87H9Q=' 
WHERE 
  key_id = 'aa4f074401ba9c837460230afffdeeb4d1cba26f5398816cfc0a0c21bf1f4f85' 
  AND (
    token = 'CYbodil5oxHMWi7/gwc8CvW9jczCqkP0HI3reV87H9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028