UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z/lSnydEiMq0eQqHPHgYN7smMpNUUPWt1TpD16yxfHU='
WHERE
key_id = '74b389e6daafd93a0b2d740714994b7ad11bd94c91bf1004a8e6fa9c2517e3a6'
AND (
token = 'z/lSnydEiMq0eQqHPHgYN7smMpNUUPWt1TpD16yxfHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)