UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JWAx41VHLl7biGUqrs+9GWBO4wPFwlsM8hvRLgCrNkI=' 
WHERE 
  key_id = '05802666668a30180ccd49d1c55c08e028fefb34979ee37b8f5e5eeee1765ed5' 
  AND (
    token = 'JWAx41VHLl7biGUqrs+9GWBO4wPFwlsM8hvRLgCrNkI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00085