UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W0DbgRV5qy+pfXcoPaRp8b83UQnWZ5qx4uwqgSJFfDw=' 
WHERE 
  key_id = '3af39fa843ef76612f3386389190d54b07ce6a892417599dea10305d632ff3ab' 
  AND (
    token = 'W0DbgRV5qy+pfXcoPaRp8b83UQnWZ5qx4uwqgSJFfDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050