UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TnEzsyumaKNL3RlRrQ1jueCnNCDc/wfWuLLibiZVNes=' 
WHERE 
  key_id = 'b6894c8541d81d62e8ef3b99794fe8e5ce97f71aaa31f6f6ad36b051943ed076' 
  AND (
    token = 'TnEzsyumaKNL3RlRrQ1jueCnNCDc/wfWuLLibiZVNes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032