UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'amMG0cpiz5VH3elqEHa5pGdM3ahCtdEuLsSLnsqoKlg='
WHERE
key_id = '84ee339c5a173852bb8610f5795974a00b5e8ce42eb34c9881011d09dc826a0c'
AND (
token = 'amMG0cpiz5VH3elqEHa5pGdM3ahCtdEuLsSLnsqoKlg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)