UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't+mw2sBf5qwxmMHkkk1Z2X527vZLVbxA9okUKZDQap4=' 
WHERE 
  key_id = '5b89400907a0e778a5bd83c1a2608375f1a68116effe197dd78e7387a8e9dfd3' 
  AND (
    token = 't+mw2sBf5qwxmMHkkk1Z2X527vZLVbxA9okUKZDQap4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026