UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e/9XJqhuNbwf1CUA0uzC5MGvwnzGJfCmXLQVR1t3rtk='
WHERE
key_id = '17a9175744bff6c434221440e1153768267fdd47c8b4fc8f24d1080fa69d525d'
AND (
token = 'e/9XJqhuNbwf1CUA0uzC5MGvwnzGJfCmXLQVR1t3rtk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)