UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9idAwSXP2jjSgXMgdg6OafPmiRMudrAbLHs6U1j+IH8='
WHERE
key_id = 'e8ad8e19e81878659884078c72e05a00e517be5ea34931dfb08fca50d87277c5'
AND (
token = '9idAwSXP2jjSgXMgdg6OafPmiRMudrAbLHs6U1j+IH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)