UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm2CbXpPMUKHcLjFsVCNUZp6H8SmbXLCf4ovx3Ogebdg='
WHERE
key_id = '9387cb567495e78a13b45d45138e355b49ebca2f8b27066c355ef35f74253d8f'
AND (
token = 'm2CbXpPMUKHcLjFsVCNUZp6H8SmbXLCf4ovx3Ogebdg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)