UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4kYVweKIc6ahnN/glweci86xyRVnb4z384/KSn+Dy+g='
WHERE
key_id = '415be566bbea4d9b2511e90c075cbf54d34118e38b6402f91e890e2c31bde34d'
AND (
token = '4kYVweKIc6ahnN/glweci86xyRVnb4z384/KSn+Dy+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)