UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RUKACmblYNR8yTuefG8BdDKeB6xb5RYpCT9XtJbom40=' 
WHERE 
  key_id = '3178393bb9680ab4ecfad36d63155a20319b6e5cd4f49ba28dad11c5a80166f4' 
  AND (
    token = 'RUKACmblYNR8yTuefG8BdDKeB6xb5RYpCT9XtJbom40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042