UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHnVQDR3mSt69Aq5TEUKyxAJYwu8Kv4kdGaG2jWVGXE=' 
WHERE 
  key_id = 'ddc72d7ed15440700ee21a5165746a2c7ac9d59e20c29736a0fef8018fe475ab' 
  AND (
    token = 'BHnVQDR3mSt69Aq5TEUKyxAJYwu8Kv4kdGaG2jWVGXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058