UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sdYZ4G/6bXmgRlufF0OTW5JjJeJKsI2vZtZyUH38mQo=' 
WHERE 
  key_id = '3a8f17a4094693f60d51626c9e886e07a3f78223abd4defb9e61154c70f03fb3' 
  AND (
    token = 'sdYZ4G/6bXmgRlufF0OTW5JjJeJKsI2vZtZyUH38mQo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030