UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nDBlTXCcJ0KDJUcP2id74S+6oAxb+/n88XnaZ58yeD0='
WHERE
key_id = '0931d7d38c28d4f40e19b43499e4409d40f121fb85476a0a453f5acdf1b6da90'
AND (
token = 'nDBlTXCcJ0KDJUcP2id74S+6oAxb+/n88XnaZ58yeD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)