UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j0uCcLYzWDHnieBLaTSfBM1q4H2v8VcPdatGZT7eqdw='
WHERE
key_id = 'dc63e101e7d9f8b56d31d963cf17c3f3670c8ccff7b34716b4f608f36d7784fc'
AND (
token = 'j0uCcLYzWDHnieBLaTSfBM1q4H2v8VcPdatGZT7eqdw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)