UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MOAa/8sMJgWa+y8Mm0ndxRw8orbP3C7pLyXHS0CPRgQ=' 
WHERE 
  key_id = 'b824649a198d23781e4feaa2fc92396925984855191478e4a176bc9658a966d2' 
  AND (
    token = 'MOAa/8sMJgWa+y8Mm0ndxRw8orbP3C7pLyXHS0CPRgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024