UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WxUxWHnR8y0RExpiLJuWd0+oCuA2zkgIN1hQOm78aSs=' 
WHERE 
  key_id = '0478e84b33c6d339ff8432e347e3e266a28b0d14b896ed529bd639762c07da87' 
  AND (
    token = 'WxUxWHnR8y0RExpiLJuWd0+oCuA2zkgIN1hQOm78aSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040