UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ieU0a+h8kRWSPYDVtCSZ/APXKtHv1jwXMCgutyxVINA='
WHERE
key_id = '5382acfd5e49f3bc5648059a11ea18dd5148d89167afe9a4b52a8398f0d973f3'
AND (
token = 'ieU0a+h8kRWSPYDVtCSZ/APXKtHv1jwXMCgutyxVINA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)