UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+cPMVD605A+yTqKdPRJvrVU0cgDfNLYx+sBGakNecho=' 
WHERE 
  key_id = 'e085b7bbfe8ffbee016cab98f4b85066a90380206c7b1df9fbc56cb79253061b' 
  AND (
    token = '+cPMVD605A+yTqKdPRJvrVU0cgDfNLYx+sBGakNecho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032