UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+7Z7vGWxdRZOD2snHsJeS+D7bT7gpV46Ft2rEco9bs=' 
WHERE 
  key_id = '24ba4193cc7a930b63b5577adb70357fc7530ad4fd6b5e92415208977866d94e' 
  AND (
    token = 'D+7Z7vGWxdRZOD2snHsJeS+D7bT7gpV46Ft2rEco9bs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034