UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XKvjjTaS7ZmWSRUCzLJwVLA4F1yyp3yCETP86ilaPTs=' 
WHERE 
  key_id = '7a13908362940f2dd7d0df07f3fe20921b5241f6ea5af6b3b0d8255e157a4506' 
  AND (
    token = 'XKvjjTaS7ZmWSRUCzLJwVLA4F1yyp3yCETP86ilaPTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044