UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5PoyGaXuL4RfU5n64nejrLIdmI+7eD2pTbDqz4aQQbg='
WHERE
key_id = 'aa5b891a8064179324161b7b7f27077df4a243e1b58f6a2ad5cf48ca610f5f5b'
AND (
token = '5PoyGaXuL4RfU5n64nejrLIdmI+7eD2pTbDqz4aQQbg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)