UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lK0EhUVwQmD6d9l7W1YP7vlBGk2PcDWfgmoyh0x/k5Y=' 
WHERE 
  key_id = '825dba208e3abfe9994d84c5b899f72b172713e5754c4bdd14e801f6885c6b1e' 
  AND (
    token = 'lK0EhUVwQmD6d9l7W1YP7vlBGk2PcDWfgmoyh0x/k5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050