UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W0+ft0T47W61jRnRo4w5ILzBdZY/D6VG3Ca+yCEbMMA=' 
WHERE 
  key_id = '7565e52b8fb10894f6c018629c502bf321654e518abc531911bcc0041ea8fc94' 
  AND (
    token = 'W0+ft0T47W61jRnRo4w5ILzBdZY/D6VG3Ca+yCEbMMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023