UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NvKhUzwL3P4ByZeHxX5FdXwrLCUVosonsi3dtkzYlwk='
WHERE
key_id = '418ec5f54a3aeee05dfdf8c3e31f44374772faec3b4edbaa6d68f4404d45ae4d'
AND (
token = 'NvKhUzwL3P4ByZeHxX5FdXwrLCUVosonsi3dtkzYlwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)