UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UbVUGIve5jeUytqKfEGPnxEgNcjSXXRFI9YYb0rAjjQ='
WHERE
key_id = '3f1c867cdbe4ae7c263923d0e54b9af8170eb82ce95554efa11ba252ebf0146a'
AND (
token = 'UbVUGIve5jeUytqKfEGPnxEgNcjSXXRFI9YYb0rAjjQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)