UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W10ADGimmqOX7yrL+m2nTGs3J4fO0dExa5GBAwad3uI=' 
WHERE 
  key_id = '26d9af417ab0f4cab365b7952e4ba03e21c7668b9d67ca52c7d3928adb77b034' 
  AND (
    token = 'W10ADGimmqOX7yrL+m2nTGs3J4fO0dExa5GBAwad3uI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037