UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Osi06KfJ7WO+olxvomOhseSdwa+aHatqciEf58pgm0=' 
WHERE 
  key_id = 'f9d222aa60d7a0bd18b7163f09f4a84c05021766722649379997fac475a9233c' 
  AND (
    token = '7Osi06KfJ7WO+olxvomOhseSdwa+aHatqciEf58pgm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038