UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hQtWA/fZguYsnEhAG65G8SIlZS8ko3iXjHHidfU/5RY='
WHERE
key_id = 'd2e3df6b2fbd0dbbf2dce277c31c434c4c52f2834fb7a3416e50970cea54eda5'
AND (
token = 'hQtWA/fZguYsnEhAG65G8SIlZS8ko3iXjHHidfU/5RY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)