UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w4KCl17P2HqRlRMTLBx7aajLgaVDWlMnJYPCVySrnLE=' 
WHERE 
  key_id = 'd2905db63643bf8df0b0e91675f910d41a7d6af91c83f06a4292f08b59596ee1' 
  AND (
    token = 'w4KCl17P2HqRlRMTLBx7aajLgaVDWlMnJYPCVySrnLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049