UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hxkAMrpIlpQU2a/QNKFGIyqzqLIxXWTXz455fKkGkok=' 
WHERE 
  key_id = 'aa959782311c5590b5ab47f4fac973b0b8b7944b12a42c46444e65065b9297c2' 
  AND (
    token = 'hxkAMrpIlpQU2a/QNKFGIyqzqLIxXWTXz455fKkGkok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047