UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HoHg3mR5x4iui2c1gsWH2lcxr5uR1Q7Rj2FLWMhqo0I=' 
WHERE 
  key_id = '2ee9152e7be3564f65d19fbfc0b168ce7af2447c313117ef9a4702b0aed38ac4' 
  AND (
    token = 'HoHg3mR5x4iui2c1gsWH2lcxr5uR1Q7Rj2FLWMhqo0I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023