UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vr0ADkaLan16dWQT6bc6YtbUrw/tTkK6KF8uP30XVkI='
WHERE
key_id = 'e18b84d560412b945d0dfd6ab9bb66105f716b1d06684e74805724aa3719f8a2'
AND (
token = 'vr0ADkaLan16dWQT6bc6YtbUrw/tTkK6KF8uP30XVkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)