UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBXhJ9sOKIcQstS31J/qugoaFcb5aYxKTUiA6uKe3BU='
WHERE
key_id = '7d0b3255ba673ca32218934ba712076bc6537d647602d7f038cbd17302ed1264'
AND (
token = 'XBXhJ9sOKIcQstS31J/qugoaFcb5aYxKTUiA6uKe3BU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)