UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MRIsw+bxBPQSM36QLrANIUxKRSLKdVVlbMmvYUQ4O3E=' 
WHERE 
  key_id = '3e15a926805d741b66023d164d72c472563133eb6da314ad03a5dedab9ef70b4' 
  AND (
    token = 'MRIsw+bxBPQSM36QLrANIUxKRSLKdVVlbMmvYUQ4O3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044