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