UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HyyVRXLwE/+QxjeT1Kn69c65AsH/1+DkjArfv5mHjIU=' 
WHERE 
  key_id = '20b66b9fd4294000e64746755fe8fb913f075276e7044593928ff4572635f4da' 
  AND (
    token = 'HyyVRXLwE/+QxjeT1Kn69c65AsH/1+DkjArfv5mHjIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031