UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+qI21JEtkv/BFpvEq08As6ywJZyJ0EOeUdsoNHBjP48=' 
WHERE 
  key_id = '0bdb84205d45052fd2a1376df84837ba121e232f8f9dc1ccc9dfbf28150f9e98' 
  AND (
    token = '+qI21JEtkv/BFpvEq08As6ywJZyJ0EOeUdsoNHBjP48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023