UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yYT88aQK+Q4MLmAkiJX7sPDmNsFXx2FbtgW1+L/9ZoE=' 
WHERE 
  key_id = 'df794d1dc28362783212819f23fa49f6755fbc359fe5d6076a85c982f0927485' 
  AND (
    token = 'yYT88aQK+Q4MLmAkiJX7sPDmNsFXx2FbtgW1+L/9ZoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043