UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xPiFm9ZUtaG02u4n5BV/qYqOpZSXwxCi1rxGz+/ihOY='
WHERE
key_id = 'e6beaa9f452d624f35cd0e62ff552f6151d5537668524ab643d202730a7963e3'
AND (
token = 'xPiFm9ZUtaG02u4n5BV/qYqOpZSXwxCi1rxGz+/ihOY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)