UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RT+J6mXy6rv3LxBLms5voA+JiMHhD7DiPvvt2MM0gN0=' 
WHERE 
  key_id = '1fe6b519614178d551758f65d44fc0ae72bf1f06307627369b504bd842a97445' 
  AND (
    token = 'RT+J6mXy6rv3LxBLms5voA+JiMHhD7DiPvvt2MM0gN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034