UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6M9N49erD3BPvtsU00ypaY5Xq42HU4lds5emU5sntEU=' 
WHERE 
  key_id = 'd64441b24617a3cda68a020c341a3a46bd6fae01f1c22d3c6b6efb2123938c59' 
  AND (
    token = '6M9N49erD3BPvtsU00ypaY5Xq42HU4lds5emU5sntEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016