UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Q1VEa+ybFWEGLgmISrSUXMnvy8Yv8WGEaRr0oTG2C4=' 
WHERE 
  key_id = '71257ce2095a30e54d1f66ad2d0c80ac5869425a1005e937ee12af4321766e2d' 
  AND (
    token = '0Q1VEa+ybFWEGLgmISrSUXMnvy8Yv8WGEaRr0oTG2C4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040