UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kjHe8mAooG/yrOKYRnWSbjhS/69OIhCmTKogAwh2HMg=' 
WHERE 
  key_id = '51110ad1e9806faee92e58d14939991d95170dd2c0bebb8b5705daa9110405a2' 
  AND (
    token = 'kjHe8mAooG/yrOKYRnWSbjhS/69OIhCmTKogAwh2HMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035