UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z/tgoNeGTHktY0DVExrvJ8v1oc6h4l+k6H4G10KlVpE=' 
WHERE 
  key_id = '20fd038bf81375805ba8989224501aee2c32ead0e0f24c72d51ca9c1d9ece1da' 
  AND (
    token = 'Z/tgoNeGTHktY0DVExrvJ8v1oc6h4l+k6H4G10KlVpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031