UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aMCB0Za9aA/a64Y7ppMy3HE452oIg2k8KYEYD8Kl44M='
WHERE
key_id = 'f647b9509cad4dd82960d15cc34598cefc26789718bb736cd7a03512d51cf011'
AND (
token = 'aMCB0Za9aA/a64Y7ppMy3HE452oIg2k8KYEYD8Kl44M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)