UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YlRdnfG3ygDe8pegfGcwp1Czg6CCktP2F2Ol7pCHLD0=' 
WHERE 
  key_id = '3be8711f07ed06cf4e3f9ab06d549287857512d863e4e882dd1e546fcd96dbcd' 
  AND (
    token = 'YlRdnfG3ygDe8pegfGcwp1Czg6CCktP2F2Ol7pCHLD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043