UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3BafpBG007IKXQe5Yu6DrXazdkQljnL9nqohIwIo+0U='
WHERE
key_id = '538ca8aa3acdf5dfa595f93ed63ba2656b9b33345ca65347576fe528b81672b0'
AND (
token = '3BafpBG007IKXQe5Yu6DrXazdkQljnL9nqohIwIo+0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)