UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HdNOCsfdcwcp2ZbF9i4y+204cOxbBDlvh96pcShMMQU=' 
WHERE 
  key_id = '8dfbd917237199e9cf3cb35f0dcf377498173083e80290cc4e482490efb42916' 
  AND (
    token = 'HdNOCsfdcwcp2ZbF9i4y+204cOxbBDlvh96pcShMMQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028