UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZWe5mY/4lz8FarzWX9eDfbdlaBe/pvN8Z+8211cJYv8='
WHERE
key_id = 'aa15792bf36f83c137e4eedfe31016bd1ebd938cae07559be1f03306e775c5cb'
AND (
token = 'ZWe5mY/4lz8FarzWX9eDfbdlaBe/pvN8Z+8211cJYv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)