UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5Ham38I36H5G6M9SilbfZvinkSDziYVwENtjK/3i2II=' 
WHERE 
  key_id = 'f0625c3d174b137436486af3f71e80a7d80c398b6027d0c049324b7d92de8300' 
  AND (
    token = '5Ham38I36H5G6M9SilbfZvinkSDziYVwENtjK/3i2II=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035