UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qns0UBjedjfPKAU70JZsNOpk0OKmbqFdehS13g50x04='
WHERE
key_id = '5e550fbe5bc3f45180806347b4ba8a89a3848cd5f0100472cb4e03511d079376'
AND (
token = 'qns0UBjedjfPKAU70JZsNOpk0OKmbqFdehS13g50x04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)