UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gICEZATuPd86lzpnZFaKUqfPT2oVf/CNicsjAt4sNuE=' 
WHERE 
  key_id = 'aa718f25c5ad03a1a25b435e8293ac631c9e322499bbe17f9973d2d70b2c5219' 
  AND (
    token = 'gICEZATuPd86lzpnZFaKUqfPT2oVf/CNicsjAt4sNuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038