UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WPcPWd7ClJSj1t5OolxGZ6n6QkfM9PnTJNFzccNj02k='
WHERE
key_id = '4c2ffde9658fce8aaf4e4d6210136346f6e05d04efebb5973a5a9580aead34be'
AND (
token = 'WPcPWd7ClJSj1t5OolxGZ6n6QkfM9PnTJNFzccNj02k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)